package com.myidis.mapper;

import java.util.List;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import com.myidis.entity.RightUserGroup;

public interface RightUserGroupMapper {
	@Select("SELECT * FROM right_usergroup")
    @Results({
        @Result(property = "name", column = "name")
    })
    List<RightUserGroup> all();

    @Select("SELECT * FROM right_usergroup WHERE id = #{id}")
    @Results({
        @Result(property = "name", column = "name")
    })
    RightUserGroup getOne(int id);
    
    @Select("SELECT * FROM right_usergroup WHERE name = #{name}")
    @Results({
        @Result(property = "name", column = "name")
    })
    RightUserGroup getByName(String name);

    @Insert("INSERT INTO right_usergroup(name) VALUES(#{name})")
    int insert(RightUserGroup dept);

    @Update("UPDATE right_usergroup SET name = #{name} WHERE id = #{id}")
    int update(RightUserGroup dept);

    @Delete("DELETE FROM right_usergroup WHERE id = #{id}")
    int delete(int id);
}
